<?php

session_start();
define( 'ABSPATH', dirname( __FILE__ ) );
define( "INC_PATH" , ABSPATH."/includes");
include( INC_PATH."/constant.php" );
include( INC_PATH."/functions.php" );
include( INC_PATH."/permission.php" );
include( INC_PATH."/xtemplate.class.php" );
include( INC_PATH."/class.database.php" );
include( INC_PATH."/class.user.php" );
include( INC_PATH."/class.topic.php" );
include( INC_PATH."/class.messages.php" );
include("config.php");

#Layout variable
$template = 'default';

define( "LAYOUT_URL", ABS_URL."layout/$template/" );

# VAR GLOBAL

# PAGE PROCESSING
$pageContent	= "";

$db = new Datababase();
$message = new Message();
$page = isset($_REQUEST['page'])?$_REQUEST['page']:"home";
$page_title = "Home";
$template2 = "detfafafa";
$user = new User();
$topic = new Topic();

if(is_file(PAGE_PATH."/$page/index.php"))
        try{
            include( PAGE_PATH."/$page/index.php" );
        }catch (Exception $e){
            $pageContent = "<div id='msg'>".$e->getMessage()."</div>";
        }
else
	die("Restricted access 232!");

# LAYOUT PROCESSING
if(is_file(LAYOUT_PATH."/".$template.'/index.php'))
	include( LAYOUT_PATH."/".$template.'/index.php' );
else
	die("Restricted access!");
?>